Skip to content

Conversation

@zmughal
Copy link

@zmughal zmughal commented Aug 11, 2022

This is implemented on top of #12.

  • PostfixDeref: directly dereference instead of using map

Fixes #13.

zmughal and others added 7 commits August 8, 2022 20:03
With the release of PPR v0.001000 there is a backwards incompatible
change in the definition of the `PerlTerm` rule to include postfix
arrows for dereferencing and methods.

This affects the plugin(s):

    $ git grep -lP '\b(Perl)?(Term|((ScalarAccess|ArrayAccess)(NoSpace)?))' lib/
    lib/Babble/Plugin/PostfixDeref.pm
Newer PPR handles the postfix dereference in `PerlTerm` while
`PerlScalarAccess` handles indexing without any arrows.

This also addresses the issue of <shadow-dot-cat#3>.
This adds the tests from that PR (djerius++).

Co-authored-by: Diab Jerius <[email protected]>
For PostfixDeref that is interpolated in quote-likes.
Using `map` to translate the postfix subscripts does not work with
`push`, `pop`, `shift`, `unshift`, `splice`, and other built-ins that
modify the parameter as the `map` is using a copy.

This change makes the translation of
```perl
$foo->$*
```
into
```perl
${ $foo }
```
instead of
```perl
(map $$_, $foo)[0]
```

Fixes <shadow-dot-cat#13>.
zmughal added a commit to zmughal/Babble that referenced this pull request Sep 4, 2022
…-access

PostfixDeref: direct dereference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostfixDeref: translation using map construct does not work with push, etc

1 participant